package test.word;

import java.io.File;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.io.FileUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
//import org.jeecgframework.poi.word.WordExportUtil;

public class CreateFile2 {

	public static void main(String[] args) throws Exception {

		File templateFile = new File("C:/【范例】毕业设计说明书指导教师&评阅人评语.doc");

		List<String> list = FileUtils.readLines(new File("C:/ttt.txt"), "gbk");

		for (String name : list) {
			String[] ss = name.split("_");

			String newFilePath = "C:/【范例】毕业设计说明书指导教师&评阅人评语.docx".replace("C:/【范例】", "C:/TTT/" + ss[0] + "_" + ss[1] + "_");
//			FileUtils.copyFile(templateFile, new File(newFilePath));

			Map<String, Object> map = new HashMap<>();
			map.put("name", ss[1]);
			map.put("xuehao", ss[0]);
			map.put("timu", ss[2]);

//			XWPFDocument doc = WordExportUtil.exportWord07("C:/【范例】毕业设计说明书指导教师&评阅人评语.docx", map);

			FileOutputStream fos = new FileOutputStream(newFilePath);
			
//			doc.write(fos);
			
//			doc.close();
			
			fos.flush();
			fos.close();
		}

	}
}
